package com.liuzhu.chaoshikucungunli;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import androidx.appcompat.app.AppCompatActivity;
import com.liuzhu.chaoshikucungunli.utils.SharedPreferencesManager;

public class SplashActivity extends AppCompatActivity {
    private static final int SPLASH_DISPLAY_TIME = 1000; // 启动页显示1秒

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash);

        new Handler().postDelayed(() -> {
            // 检查登录状态
            SharedPreferencesManager prefsManager = SharedPreferencesManager.getInstance(this);
            Intent intent;
            if (prefsManager.isLoggedIn()) {
                intent = new Intent(this, HomeActivity.class);
            } else {
                intent = new Intent(this, LoginActivity.class);
            }
            startActivity(intent);
            finish();
        }, SPLASH_DISPLAY_TIME);
    }
} 